package com.example.springboot.demo.controller;

import cn.hutool.core.collection.CollUtil;
import com.fasterxml.uuid.Generators;
import com.fasterxml.uuid.impl.TimeBasedEpochGenerator;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/java")
public class JavaUUIDGenerator {

    private TimeBasedEpochGenerator V7_GENERATOR = Generators.timeBasedEpochGenerator();

    @GetMapping("/v7")
    @ResponseBody
    public Object v7() {
        List<Object> list = CollUtil.newArrayList();
        for (int i = 0; i < 10; i++) {
            list.add(V7_GENERATOR.generate());
        }
        return list;
    }

}
